<template>
	<view class="agreement">
		<rich-text :nodes="content"></rich-text>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				imgUrl:this.$utils.imgUrl,
				type:'',
				content:''
			};
		},
		onLoad(option) {
			this.type = option.type
			if(option.type=='yinsi'){
				uni.setNavigationBarTitle({
					title:'隐私协议'
				})
				this.yinsi()
			}else if(option.type=='yonghu'){
				uni.setNavigationBarTitle({
					title:'用户协议'
				})
				this.yonghu()
			}else if(option.type=='guanyu'){
				uni.setNavigationBarTitle({
					title:'关于我们'
				})
				this.guanyu()
			}else if(option.type=='bangzhu'){
				uni.setNavigationBarTitle({
					title:'帮助中心'
				})
				this.bangzhu()
			}
		},
		methods:{
			guanyu(){
				this.$httpapi('index/about', 'POST',{}).then(res => {
					this.content = res.data.replace(/\<img/gi, '<img style="max-width:100%; display: block;"');
					this.content = this.content.replace(/\ src="/gi, ' src="'+this.imgUrl);
				})
			},
			yinsi(){
				this.$httpapi('selectsysNotice', 'POST', {}).then(res => {
					// this.content = res.data[2]
					this.content = res.data[1].notice_content.replace(/\<img/gi, '<img style="max-width:100%; display: block;"');
				})
			},
			yonghu(){
				this.$httpapi('selectsysNotice', 'POST', {}).then(res => {
					// this.content = res.data[2]
					this.content = res.data[0].notice_content.replace(/\<img/gi, '<img style="max-width:100%; display: block;"');
				})
			},
			bangzhu(){
				this.$httpapi('Index/help', 'POST',{}).then(res => {
					this.content = res.data.replace(/\<img/gi, '<img style="max-width:100%; display: block;"');
					this.content = this.content.replace(/\ src="/gi, ' src="'+this.imgUrl);
				})
			},
		}
	}
</script>

<style lang="scss">
	.agreement{
		padding:20rpx;
		font-size: 28rpx;
		font-weight: 500;
		color: #000000;
	}
</style>
